import request from '@/utils/request.js'
import { useUserStore } from '@/stores/userStore.js'

/**
 * 司机充值
 */
export function recharge ({ amount, payChannel, rechargeType }) {
	return request.post({
		url: `/recharge/recharge`,
		data: {
			amount,
			payChannel,
			rechargeType
		}
	})
}

/**
 * 司机充值前检查是否有待支付订单
 */
export function checkRecharge () {
	return request.get({
		url: `/recharge/checkRecharge`
	})
}

/**
 * 查询充值记录列表
 */
export function getRechargePage ({ pageNum, pageSize }) {
	return request.get({
		url: `/recharge/page`,
		params: {
			pageNum, 
			pageSize
		}
	})
}

/**
 * 取消充值
 */
export function cancelRecharge (id) {
	return request.delete({
		url: `/recharge/cancel/${id}`
	})
}

/**
 * 继续充值
 */
export function continueRecharge (id) {
	return request.get({
		url: `/recharge/continue/${id}`
	})
}

/**
 * 查询会员价格
 */
export function getVipPrice () {
	return request.get({
		url: `/recharge/getVipPrice`
	})
}